home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
F1 Licenseware
/
F1 Licenseware - Volume 1.iso
/
disks
/
089a.dms
/
089a.adf
/
EXAMPLE_PROGRAMS
/
example28.AMOS
/
example28.amosSourceCode
Wrap
AMOS Source Code
|
1992-03-06
|
2KB
|
96 lines
'==================
'EXAMPLE PROGRAM 28
'==================
'A pic ripper
'
'This sets aside a large area of memory to load a program into
'--------------------------------------------------------------
Set Buffer 250
Flash Off : Curs Off : Paper 0 : Cls 0
'This is the main loop
'---------------------
Do
Gosub _LOADPIC
If ADR>0
Gosub _HEADER
End If
If ADR<>0
ADR=0 : Gosub _SEARCHPICS
End If
Loop
'The rest are all subroutines called from the main loop
'BLoad the file in using the file selecter
'-----------------------------------------
_LOADPIC:
F$=Fsel$("*.*","","LOAD EXE")
If Length(10)>0 Then Erase 10
Open In 1,F$ : BL=Lof(1)
Reserve As Data 10,BL
Close 1
Bload F$,10
COUNT=Start(10)
'This is where we do all the searching
'-------------------------------------
_SEARCHPICS:
SEARCH$="Pac"
ADR=Hunt(COUNT To Start(10)+Length(10),SEARCH$)
If ADR=0 Then Print "ALL DONE! NO (MORE) PICS FOUND" : Wait 120 : Return
If Peek(ADR+4)=80 and Peek(ADR+5)=105 and Peek(ADR+6)=99
B$="PIC.PAC HEADER FOUND AT"+Str$(ADR)
Print ,B$
COUNT=ADR+100
End If
Return
'Restore the picture to be a true Amos ABK pic
'---------------------------------------------
_HEADER:
'
'poke AmBk at new start of bank
Poke ADR-12,65
Poke ADR-11,109
Poke ADR-10,66
Poke ADR-9,107
'
'restore some data discarded by compiler
Poke ADR-8,0
Poke ADR-7,$A
Poke ADR-6,0
Poke ADR-5,0
Poke ADR-4,$80
Poke ADR-3,0
Poke ADR-2,$1C
Poke ADR-1,$32
'Guess length for now
Bsave "ram:pic.abk",ADR-12 To ADR+72000
Gosub _VIEWPIC
Gosub _SAVEPIC
Return
'Display picture if any found
'-----------------------------
_VIEWPIC:
Load "ram:pic.abk",11
Unpack 11 To 0
Wait 25
While Mouse Key=0 : Wend
Return
'Let user save if
'-----------------
_SAVEPIC:
F$=Fsel$("*.*","","SAVE IFF")
Save Iff F$,0
Return